package com.data.platform.core.exception;

import com.data.platform.core.enums.ResponseCode;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 业务异常类
 */
@Getter
@AllArgsConstructor
public class BaseException extends RuntimeException{

    private static final long serialVersionUID = 977952298047721404L;

    private Integer code;

    private String message;

    private Object[] params;

    public BaseException(ResponseCode responseCode) {
        this(responseCode.getCode(), responseCode.getMessage(), null);
    }

    public BaseException(ResponseCode responseCode, Object... params) {
        this(responseCode.getCode(), responseCode.getMessage(), params);
    }

    public BaseException(Object... params) {
        this(null, null, params);
    }
}
